#include <iostream>

using namespace std;

void reverseArray(char *arr, int start, int end)
{
	char *p1, *p2;
	char tmp;
	p1 = arr + start;
	p2 = arr + end;
	while (p1 < p2){
		tmp = *p1;
		*p1 = *p2;
		*p2 = tmp;
		p1++;p2--;
	}
}

void rotateArray(char *arr, int size, int k)
{
	reverseArray(arr, 0, size - 1);
	reverseArray(arr, 0, k - 1);
	reverseArray(arr, k, size-1);
}



int rotateArrayTest()
{
	char testData[] = "123456789";
	int size = 9, k = 3;

	rotateArray(testData, size, k);

	cout <<testData <<endl;

	cin.get();

	return 0;
}